{include file='fcworker/fc_head'}
<style type="text/css">
    .btn-div{
        width: 100%;
        text-align: center;
        margin: 0 auto;
    }
    .btn{
        width: 184px;
        height: 35px;
        background-color: #5c99f7;
        border-radius: 50px;
        border: 0;
        margin-top: 20px;
        color: #fff;
        font-size: 15px;
        font-weight: 400;
    }
</style>
<body style="background:#f8f8f8">
<div id="mescroll" class="mescroll">
    <div id="app">
        <div class="setTitle_h">
            <a href="javascript:history.back(-1)"></a>
            基本设置
        </div>
        <form id="myform3">
            <div class="setActive">
                <div class="actTit">
                    活动信息
                </div>
                <ul>
                    <li>
                        <p>活动主标题</p>
                        <input type="text" name="title" placeholder="活动主标题,精而简,建议15字左右,尽量不要超27个汉字,不可包含特殊符号" confirm-type="next" value="{$theme['title']}">
                    </li>
                    <li>
                        <p>活动副标题</p>
                        <input type="text" name="desc"  placeholder="活动副标题,建议40字以内,不可包含特殊符号" confirm-type="next" value="{$theme['desc']}">
                    </li>
                    {if $system['ispresale']==1}
                    <li>
                        <p>补款：主标题</p>
                        <input type="text" name="presale_title" placeholder="活动主标题,精而简,建议15字左右,尽量不要超27个汉字,不可包含特殊符号" confirm-type="next" value="{$config['presale']['title']}">
                    </li>
                    <li>
                        <p>补款：副标题</p>
                        <input type="text" name="presale_desc"  placeholder="活动副标题,建议40字以内,不可包含特殊符号" confirm-type="next" value="{$config['presale']['desc']}">
                    </li>
                    {/if}
                    <li>
                        <p>活动结束时间</p>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="test5"  value="{$theme['endtime']}">
                        </div>
                        <input type="hidden" name="endtime" id="endtime" value="{$theme['endtime']}">
                    </li>
                    <li>
                        <p>活动状态</p>
                        <div class="choseBar2 choseBar11">
                            <span  class="{php echo $status==0?'on':'';}" data-value="0"  >暂停</span>
                            <span class="{php echo $status==1?'on':'';}" data-value="1">启用</span>
                            <span class="{php echo $status==2?'on':'';}" data-value="2">结束</span>
                        </div>
                        <input type="hidden" name="status" id="status" value="{$status}">
                    </li>
                </ul>
                <div class="actTit">
                    价格设置
                </div>
                <ul>
                    {if $system['ruanjian']==1 || $system['softstyle']==104}
                    <li>
                        <p>报名费</p>
                        <input type="text" name="joinfee" placeholder="价格为空为免费报名" value="{$config['joinfee']}">
                    </li>
                    <li>
                        <p>活动限购人数</p>
                        <input type="number" name="renshu"  value="{$config['renshu']}">
                        <input hidden name="maxcount" value="1" />
                        <input hidden name="maxcountall" value="1" />
                    </li>
                    {elseif $system['softstyle']==5}
                    <li>
                        <p>全款加盟价</p>
                        <input type="text" name="groupprice" placeholder="如：支付999元全款加盟" value="{$config['groupprice']}">
                    </li>
                    <li>
                        <p>定金听课价</p>
                        <input type="text" name="primeprice" placeholder="如：预付9.9元线上听课" value="{$config['primeprice']}">
                    </li>
                    <li>
                        <p>线上定金</p>
                        <input type="text" name="joinfee" placeholder="线上定金为空则以上上面实际金额支付" value="{$config['joinfee']}">
                    </li>
                    {else}
                    {if $system['ruanjian']==0}
                    <li>
                        <p>市场价</p>
                        <input type="text" name="marketprice" placeholder="市场价为空则不显示折扣价,即首图下方原价多少,几人团多少价的提示不显示" value="{$config['marketprice']}">
                    </li>
                    {/if}
                    <li>
                        {if $system['bottom_jiage'] == '1' || $system['bottom_jiage'] == '2'}
                        <p>拼团价①</p>
                        {else}
                        <p>拼团价</p>
                        {/if}
                        <input type="text" name="groupprice"  value="{$config['groupprice']}">
                    </li>
                    {if $system['bottom_jiage'] == '1' || $system['bottom_jiage'] == '2'}
                    <li>
                        <p>拼团价②</p>
                        <input type="text" name="groupprice2" value="{$config['groupprice2']}">
                    </li>
                    {/if}
                    {if $system['bottom_jiage'] == '2'}
                    <li>
                        <p>拼团价③</p>
                        <input type="text" name="groupprice3" value="{$config['groupprice3']}">
                    </li>
                    {/if}
                    <li>
                        <p>单买价</p>
                        <input type="text" name="primeprice" value="{$config['primeprice']}">
                    </li>
                    {if $system['jiage']>0}
                    <li>
                        <p>定金描述</p>
                        <input type="text" name="duojiagetips" placeholder="如：拍摄类型 产品类型 服务类型" value="{$config['duojiagetips']}">
                    </li>
                    <li>
                        <p>定金1：名称</p>
                        <input type="text" name="joinname" placeholder="如：婚纱照收100元，儿童/写真收50元" value="{$config['joinname']}">
                    </li>
                    {/if}
                    {if $system['jiage']<1}
                    <li>
                        <p>定金</p>
                        <input type="text" name="joinfee"  value="{$config['joinfee']}">
                    </li>
                    {else}
                    <li>
                        <p>定金1：金额</p>
                        <input type="text" name="joinfee"  value="{$config['joinfee']}">
                    </li>
                    {/if}
                    {if $system['jiage']>0}
                    <li>
                        <p>定金2：名称</p>
                        <input type="text" name="joinname2"  value="{$config['joinname2']}">
                    </li>
                    <li>
                        <p>定金2：金额</p>
                        <input type="text" name="joinfee2"  value="{$config['joinfee2']}">
                    </li>
                    {/if}
                    {if $system['jiage']>1}
                    <li>
                        <p>定金3：名称</p>
                        <input type="text" name="joinname3"  value="{$config['joinname3']}">
                    </li>
                    <li>
                        <p>定金3：金额</p>
                        <input type="text" name="joinfee3"  value="{$config['joinfee3']}">
                    </li>
                    {/if}
                    <li>
                        {if $system['bottom_jiage'] == '1' || $system['bottom_jiage'] == '2'}
                        <p>成团人数①</p>
                        {else}
                        <p>成团人数</p>
                        {/if}
                        <input type="number" name="maxcountall"  value="{$config['maxcountall']}">
                    </li>
                    {if $system['bottom_jiage'] == '1' || $system['bottom_jiage'] == '2'}
                    <li>
                        <p>成团人数②</p>
                        <input type="number" name="maxcountall2"  value="{$config['maxcountall2']}">
                    </li>
                    {/if}
                    {if $system['bottom_jiage'] == '2'}
                    <li>
                        <p>成团人数③</p>
                        <input type="number" name="maxcountall3"  value="{$config['maxcountall3']}">
                    </li>
                    {/if}
                    <li>
                        <p>活动结束时间</p>
                        <div class="choseBar2 choseBar12">
                            <span class="{php echo $tuanmode==0?'on':'';}" data-value="0">正常拼团</span>
                            <span class="{php echo $tuanmode==1?'on':'';}" data-value="1">无限成团,团满依旧可以加入</span>
                            <input type="hidden" name="tuanmode" id="tuanmode" value="{$tuanmode}">
                        </div>
                    </li>
                    <li>
                        <p>活动限购人数</p>
                        <input type="number" name="renshu"  value="{$config['renshu']}">
                    </li>
                    {/if}
                </ul>
                <div class="actTit">
                    交易凭证信息
                </div>
                <ul>
                    <li>
                        <p>主办方(如需修改需联系工作人员）</p>
                        <input type="text" name="jubf" disabled value="{$theme['jubf']}">
                    </li>
                    <li>
                        <p>客服电话</p>
                        <input type="text" name="mobile"  value="{$theme['mobile']}">
                    </li>
                    <li>
                        <p>地址:{$config['province']} {$config['city']} {$config['district']}</p>
                        <input type="text" name="addresstxt"  value="{$config['addresstxt']}">
                    </li>
                    <li>
                        <p>时间:文字描述</p>
                        <input type="text" name="zhuandantxt" placeholder="如：转单时间 选套系时间 感恩回馈日，为空时不显示" value="{$config['zhuandantxt']}">
                    </li>
                    <li>
                        <p>时间:（文本描述为空时不显示）</p>
                        <div class="layui-input-inline" style="width: 45%;">
                            <input type="text" class="layui-input"  readonly="" id="test11"  value="{$zhuandanbegintime}">
                        </div>
                        至
                        <div class="layui-input-inline" style="width: 45%;">
                            <input type="text" class="layui-input" readonly="" id="test12"  value="{$zhuandanendtime}">
                        </div>
                        <input type="hidden" name="zhuandanbegintime" id="zhuandanbegintime" value="{$zhuandanbegintime}">
                        <input type="hidden" name="zhuandanendtime" id="zhuandanendtime" value="{$zhuandanendtime}">
                    </li>
                    <li>
                        <p>活动说明</p>
                        <input type="text" name="zhuandantips" placeholder="如：定金不退不换，建议不要用最终解释权归*所有，属霸王条款" value="{$config['zhuandantips']}">
                    </li>
                </ul>
            </div>
            <div class="btn-div martop80">
                <button class="btn" id="sub3" type="button">提交</button>
            </div>
        </form>

        {include file='fcworker/fc_foot_yixuan'}
        <div class="h110"></div>

    </div>
</div>
{include file='fcworker/fc_foot'}
</body>
<script>
    const mescroll = new MeScroll("mescroll", {
        down: {
            auto: false,
            callback: () => {
                mescroll.endSuccess();
                setTimeout(() => {
                    window.location.reload();
                },500)
            }
        },
        up: {
            use: false
        }
    })
    layui.use('laydate',function () {
        let laydate = layui.laydate;
        //日期时间选择器
        laydate.render({
            elem: '#test5'
            ,format:'yyyy-MM-dd HH:mm'
            ,type: 'datetime'
            ,done:function (value, date, endDate) {
                if (value){
                    $("#endtime").val(value);
                }
            }
        });
        laydate.render({
            elem: '#test11'
            ,type: 'date'
            ,trigger: 'click'
            ,btns: ['confirm']
            ,done:function (value, date, endDate) {
                if (value){
                    $("#zhuandanbegintime").val(value);
                }
            }
        });
        laydate.render({
            elem: '#test12'
            ,type: 'date'
            ,trigger: 'click'
            ,btns: ['confirm']
            ,done:function (value, date, endDate) {
                if (value){
                    $("#zhuandanendtime").val(value);
                }
            }
        });
    });
    $('.choseBar11 span').click(function(){
        var status = $(this).data("value");
        console.log(status);
        $("#status").val(status);
        $(this).addClass('on').siblings().removeClass('on');
    })
    $(".choseBar12 span").click(function () {
        var tuanmode = $(this).data("value");
        console.log(tuanmode);
        $("#tuanmode").val(tuanmode);
        $(this).addClass('on').siblings().removeClass('on');
    });
    $('.moreChose span').click(function(){
        if($(this).hasClass('on')){
            $(this).removeClass('on')
        }else{
            $(this).addClass('on')
        }
    });
    $("#sub3").click(function () {
        var formData3 = $("#myform3").serializeArray();
        let datalist = {};
        $.each(formData3,function (index,item) {
            datalist[item.name] = item.value;
        });
        datalist['op'] = 'save';
        var postUrl="/{php echo createMobileUrl('X_setbase',array('themeid'=>$themeid));}";
        $.ajax({
            url:postUrl,
            dataType:'json',
            method:'post',
            data: datalist,
            success:function (e) {
                let data = e.data;
                let error = e.error;
                let msg = e.msg;
                if (error){
                    layer.msg(msg);
                    return;
                }else{
                    layer.msg('保存成功');
                    window.location.reload();
                }
            },
            fail:function (err) {
            }
        });
    });
</script>
</html>